/**
 * Copyright (C), 2019-2020, 宇信融汇
 * FileName: T1
 * Author:   xbliu
 * Date:     2020/6/17 9:45
 * Description: 代码块
 * History:
 * <author>          <time>          <version>          <desc>
 * xbliu           修改时间           版本号              描述
 */
package c_003;

/**
 * @Classname T1
 * @Description TODO
 * @Date 2020/6/17 9:45
 * @Created by xbliu
 */

/**
 * 代码块：被{}括起来的一段代码叫做普通代码块
 * 1、普通代码块
 * 2、构造代码块
 * 3、静态代码块
 * 4、同步代码块
 */
public class T1 {
    int a;
    int b;

    {
        System.out.println("T1的构造代码块");
    }

    static {
        System.out.println("T1的静态代码块");
    }

    public T1() {
        {
            System.out.println("T1的构造无参的构造方法");
        }
        System.out.println("T1的构造无参的构造方法");
    }

    public T1(int a) {
        this.a = a;
    }

    public T1(int a, int b) {
        this(a);
        this.b = b;
    }

    public void test() {
        System.out.println("test方法");
        {
            System.out.println("test的普通代码块");
        }
    }

    public static void main(String[] args) {
        T1 t1 = new T1(1);
        t1.test();
    }
}
